package xml2json;

import java.io.StringReader;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;
import net.javacrumbs.json2xml.JsonXmlReader;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;

public class TestJson2XML {

    public static void main(String[] args) throws Exception {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        InputSource source = new InputSource(new StringReader(""));
        DOMResult result = new DOMResult();
        transformer.transform(new SAXSource(new JsonXmlReader(), source), result);
        //transformer.transform(new SAXSource(new JsonXmlReader(namespace, addTypeAttributes, artificialRootName), source), result);
        Node n = result.getNode();

        System.out.println(n.toString());


    }
}
